#!/bin/bash

# 20220315 bkw: replacement wrapper script for gui-ufw, part of the
# gui-ufw SlackBuilds.org build, by B. Watson. WTFPL licensed.

# find the path to the script, in a way that won't break if the
# python version gets upgraded, and works on either 32-bit or 64-bit
# Slackware.
PYVER="$( python3 --version | cut -d' ' -f2 | cut -d. -f1,2 )"
for i in lib64 lib; do
  dir="/usr/$i/python$PYVER/site-packages/gufw"
  [ -d "$dir" ] && break
done

# kdesu takes care of allowing access to the X server (no need for
# xhost commands) and works fine regardless of desktop environment or
# window manager. it doesn't rely on policykit, which is a nice bonus.
exec kdesu -c "python3 $dir/gufw.py"
